package com.windaka.elements.config;

import com.windaka.elements.interceptor.RepeatSubmitInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Spring MVC 拦截器
 * @author wangning
 * @version 1.0
 * Create by 2024/2/23 15:25
 */
@Configuration
public class ResourcesConfig implements WebMvcConfigurer {

    /**
     * 重点击校验
     */
    @Autowired
    private RepeatSubmitInterceptor repeatSubmitInterceptor;

    /**
     * 将自定义拦截器挂载到SpringMVC上
     */
    @Override
    public void addInterceptors(InterceptorRegistry interceptorRegistry) {
        interceptorRegistry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
    }
}
